package com.gof.example.proxy.virtual;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/9 11:25.
 * haiming.fei@tongdun.cn
 */
public class Crawler extends AbstractCrawler {

    @Override
    void crawl(String url) {
        System.out.println("start crawl...");
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                int len = suffixs.length - 1;
                for (int i = 0; i < 10; i++) {
                    String key = "image" + i;
                    maps.put(key, key + suffixs[(int) (Math.random() * len)]);
                }
            }
        });
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
